#ifndef PROPERTIES_H
#define PROPERTIES_H

#include <esp_types.h>
#include <cJSON.h>
#include "mylist.h"

typedef enum
{
    PROPERTY_VALUE_TYPE_NUMBER,
    PROPERTY_VALUE_TYPE_BOOL,
    PROPERTY_VALUE_TYPE_STRING,
} property_value_type_t;

typedef union
{
    int number;
    bool boolean;
    char *str;
} property_value_t;

typedef struct
{
    char *name;
    char *description;
    property_value_type_t type;
    property_value_t value;
} property_t;

#define property_list_t general_list_t
#define property_list_add general_list_add
#define property_list_new general_list_new

property_t *property_create(char *name, char *description, property_value_type_t type, property_value_t value);

property_t *property_list_get(property_list_t *list, char *name);
cJSON *property_list_get_descriptor_json(property_list_t *list);
cJSON *property_list_get_state_json(property_list_t *list);

#endif